#ifndef _WDS_UI_ANIMATOR_H_
#define _WDS_UI_ANIMATOR_H_

#include "math/vec2.h"

#include <vector>

namespace ui
{
	class UIWidget;
}

class WDSAnimatedFinishCallBack
{
public:
	virtual void	OnAnimatedUIFinish() = 0;
};

class WDSAnimatedUI
{
public:
		enum	ANIMATE_STYLE
		{
			ANIMATE_STYLE_NONE,

			ANIMATE_STYLE_POPPINGUP,
			ANIMATE_STYLE_STAMP,
			ANIMATE_STYLE_CENTERSCREEN,
			ANIMATE_STYLE_HIDE_TORIGHT,
			ANIMATE_STYLE_HIDE_TOTOP,
			
			ANIMATE_STYLE_C,
		};

		WDSAnimatedUI() : m_IsFinish(false),m_pWidget(NULL) {};

		virtual void					Tick(float dt);

protected:

		friend class					WDSUIAnimator;

		ui::UIWidget*					m_pWidget;		
		
		float							m_Delay;
		bool							m_IsFinish;
		ANIMATE_STYLE					m_AnimateStyle;
		WDSAnimatedFinishCallBack*		m_pCallBack;
		
};

class WDSUIAnimator
{
public:

	

	

	static WDSUIAnimator&				Instance();

	void								Tick(float dt);
	WDSAnimatedUI*						Add(ui::UIWidget* pWidget, 
											WDSAnimatedUI::ANIMATE_STYLE Style, 
											float Delay,
											WDSAnimatedFinishCallBack* pCallBack
											);

protected:

	
	friend class WDSAnimatedUI;
	
	WDSUIAnimator(){};

	std::vector<WDSAnimatedUI*>			m_AnimatedList;
	
	
	

};


class WDSAnimatedUIPoppingup : public WDSAnimatedUI
{
public:


	enum STATE
	{
		STATE_NONE,
		STATE_BIGGER,
		STATE_RESMALL,
		STATE_FINISH,

		STATE_C,

	};

	WDSAnimatedUIPoppingup() : WDSAnimatedUI(),
							 m_Scale(0),
							 m_State(STATE_NONE)
	{};

	virtual void		Tick(float dt);

protected:

	float				m_Scale;
	STATE				m_State;
	

};

class WDSAnimatedUIMove : public WDSAnimatedUI
{
public:
	WDSAnimatedUIMove(const math::Vec2& MoveTo);

	virtual void		Tick(float dt);
	void				SetTargetPosition(const math::Vec2& Pos) { m_Target = Pos; };

protected:
	math::Vec2			m_Pos;
	math::Vec2			m_Target;
};

class WDSAnimatedUIStamp : public WDSAnimatedUI
{
public:

	enum STATE
	{
		STATE_NONE,
		STATE_SMALLER,
		STATE_FINISH,

		STATE_C,	
	};

	WDSAnimatedUIStamp() :	m_Scale(2.0f),
							m_State(STATE_NONE),
							m_Alpha(0.5f)
	{}

	virtual void		Tick(float dt);
	

protected:
	STATE				m_State;
	float				m_Scale;
	float				m_Alpha;
};



#endif